package com.nanbei.graph;


import lombok.Data;

import java.util.List;

/**
 * @ClassDescription:  图的顶点
 * @JdkVersion: 1.8
 * @Author: libs
 * @Created: 2024/7/1 14:43
 */

public class Vertex {
    // 顶点的名称
    private String name;
    // 当前顶点指向的顶点有哪些
    private List<Edge> edges;


    // 当前节点是否被访问过
    private boolean isVisited;
    // 入度数量
    private int Penetration;
    // 状态 0-未被访问 1-访问中 2-访问过   用在拓扑排序中
    private int status;
    // 距离
    private final int MAX_INT = Integer.MAX_VALUE;
    private int dist = MAX_INT;

    // 记录上一个节点从何而来
    private Vertex perv;

    public Vertex(String name) {
        this.name = name;
    }

    public Vertex(String name, List<Edge> edges) {
        this.name = name;
        this.edges = edges;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Edge> getEdges() {
        return edges;
    }

    public void setEdges(List<Edge> edges) {
        this.edges = edges;
    }

    public boolean isVisited() {
        return isVisited;
    }

    public void setVisited(boolean visited) {
        isVisited = visited;
    }

    public int getPenetration() {
        return Penetration;
    }

    public void setPenetration(int penetration) {
        Penetration = penetration;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getDist() {
        return dist;
    }

    public void setDist(int dist) {
        this.dist = dist;
    }

    public Vertex getPerv() {
        return perv;
    }

    public void setPerv(Vertex perv) {
        this.perv = perv;
    }

    @Override
    public String toString() {
        return "Vertex{" +
                "name='" + name + '\'' +
                ", dist=" + dist +
                '}';
    }
}
